import { Provide } from "@midwayjs/core";
import { BaseService } from "@cool-midway/core";
import { InjectEntityModel } from "@midwayjs/typeorm";
import { Repository } from "typeorm";
import { BaseSysCategoryEntity } from "../../entity/sys/category";
import { CommonStatus } from "../../../../interface";

@Provide()
export class BaseSysCategoryService extends BaseService {
    @InjectEntityModel(BaseSysCategoryEntity)
    baseSysCategoryEntity: Repository<BaseSysCategoryEntity>;

    async getList() {
        return await this.baseSysCategoryEntity.find({
            where: {
                status: CommonStatus.NORMAL
            },
            order: {
                order: 'ASC',
            }
        });
    }
}